package com.ruoyi.business.service;

import org.activiti.engine.history.HistoricActivityInstance;
import org.activiti.engine.history.HistoricProcessInstance;
import org.activiti.engine.history.HistoricTaskInstance;
import org.activiti.engine.repository.Deployment;
import org.activiti.engine.repository.ProcessDefinition;
import org.activiti.engine.runtime.ProcessInstance;
import org.activiti.engine.task.Task;

import java.io.IOException;
import java.io.InputStream;
import java.util.List;
import java.util.Map;

/**
 * ClassName IProcessService
 * Create by Mike
 * Date 2021/8/26 21:38
 */
public interface IProcessService {

    Deployment deploy(String filePath) throws IOException;

    ProcessDefinition selectProcessDefinitionByDeploymentId(String deploymentId);

    InputStream getResourceAsStream(String deploymentId, String resourceName);

    InputStream getProcessImage(String processDefinitionId,
                                List<String> highLightedActivities,
                                List<String> highLightedFlows);

    ProcessInstance startProcessInstanceByKey(String definitionKey,
                                              String businessKey, Map<String,Object> map);

    Task getTaskByInstanceId(String instanceId);

    void addCandidateUser(String taskId, String auditorId);

    List<String> getActiveActivityIds(String instanceId);

    ProcessInstance getProcessInstanceById(String instanceId);

    void deleteProcessInstance(String instanceId, String msg);

    long selectTodoTaskCount(String definitionKey, String candidateUser);

    List<Task> selectTodoTaskList(String definitionKey, String candidateUser, Integer firstResult, Integer pageSize);

    void claimAndComplete(Task task, String userId, Boolean auditStatus, String comment);

    Task getTaskById(String taskId);

    void setVariable(Task task, String name, Object value);

    long selectDoneTaskCount(String definitionKey, String userId);

    List<HistoricTaskInstance> selectDoneTaskList(String definitionKey, String userId, Integer firstResult, Integer pageSize);

    HistoricProcessInstance getHistoricProcessInstanceById(String processInstanceId);

    List<HistoricActivityInstance> selectHistoryTaskList(String instanceId);

    String getTaskComment(String taskId);
}
